//
//  UIView+Extension.h
//  分类
//
//  Created by 裘明 on 15/12/14.
//  Copyright © 2015年 裘明. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface UIView (Extension)<UIAlertViewDelegate, UIActionSheetDelegate>

#pragma mark - 设置Frame
@property (nonatomic, assign) CGFloat x;
@property (nonatomic, assign) CGFloat y;
@property (nonatomic, assign) CGFloat width;
@property (nonatomic, assign) CGFloat height;
@property (nonatomic, assign) CGPoint origin;
@property (nonatomic, assign) CGSize  size;
@property (nonatomic, assign) CGFloat bottom;
@property (nonatomic, assign) CGFloat right;

//在父控件中左右居中
- (void) autoWCenter;

//在父控件中上下居中
- (void) autoHCenter;

//设置Y坐标，距离aboveView的interval距离
- (void) setYAbove:(float)interval withView:(UIView *)aboveView;

#pragma mark - 动画切换效果
/**
 *  动画切换效果  push方式
 *
 *  @param direction 动画切换方向 kCATransitionFromRight、kCATransitionFromLeft、kCATransitionFromTop、kCATransitionFromBottom
 */
- (void)switchContentViewWithAnimation:(NSString *)direction;

/**
 *  动画切换效果
 *
 *  @param direction      动画切换方向 kCATransitionFromRight、kCATransitionFromLeft、kCATransitionFromTop、kCATransitionFromBottom
 *  @param transitionType 动画切换方式 kCATransitionFade、kCATransitionMoveIn、kCATransitionPush、kCATransitionReveal
 */
- (void)switchContentViewWithAnimation:(NSString *)direction type:(NSString *)transitionType;

/**
 *  动画切换效果
 *
 *  @param direction      动画切换方向 kCATransitionFromRight、kCATransitionFromLeft、kCATransitionFromTop、kCATransitionFromBottom
 *  @param transitionType 动画切换方式 kCATransitionFade、kCATransitionMoveIn、kCATransitionPush、kCATransitionReveal
 *  @param duration       时长
 */
- (void)switchContentViewWithAnimation:(NSString *)direction type:(NSString *)transitionType duration:(float)duration;

#pragma mark - view加载
//view转换成图片
- (UIImage*)getConvertViewToImage;

//根据Xib文件创建View
+ (instancetype)createWithXibName:(NSString *)xibName;

//用于添加多个子View加到本View里
- (void)addSubVs:(UIView *)object, ...;

#pragma mark - view的点击事件
/**
 有待改进 会覆盖掉其他的手势操作
 */
//给view添加按键事件
- (void)addTagEven:(SEL) mSel withTarget:(id)target;

//添加view的tag事件到block上
- (void)addTagEvenBlock:(void (^)(UIView *sender))block;

//添加长按
- (void)addTagLongEvenBlock:(void (^)(UIView *sender))block;

- (void)onClickTagBlock:(UITapGestureRecognizer *)singleTap;
- (void)onLongTapTagBlock:(UILongPressGestureRecognizer *)longTap;
//点击view的除了textview和textfiled的地方就隐藏
- (void)hideKeyboardWithOutTapTextFiledAndTextView:(NSArray *)views;

/**
 *  详细属性
 */
@property (nonatomic, copy) NSDictionary *info_Dict;

// 清理背景色
- (void)clearBackground;
@end


// MARK - IBExtension
IB_DESIGNABLE
@interface UIView (IBExtension)
/// 边线颜色
@property (nonatomic, strong) IBInspectable UIColor *borderColor;
/// 边线宽度
@property (nonatomic, assign) IBInspectable CGFloat borderWidth;
/// 脚半径
@property (nonatomic, assign) IBInspectable CGFloat cornerRadius;


@end
